﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TjZheng.Mvc;

namespace TjZheng.Example.MVC.Controllers
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
    public class FooFilter : FilterAttribute, IResultFilter
    {
        public string Identity { get; set; }
        public FooFilter(string identity)
        {
            this.Identity = identity;
        }

        public void OnResultExecuted(ResultExecutedContext filterContext)
        {
            filterContext.HttpContext.Response.Write("FooFilter.OnResultExecuted【" + this.Identity + "】<br/>");
        }

        public void OnResultExecuting(ResultExecutingContext filterContext)
        {
            //filterContext.Result = new ContentResult { Content = "123" };
            filterContext.HttpContext.Response.Write("FooFilter.OnResultExecuting【" + this.Identity + "】<br/>");
        }
    }
}